<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 系统模块数据表
 *
 * Date: 20/03/2018
 * @author George
 */
class CreateModulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('modules', function (Blueprint $table) {
            $table->string('code')->primary();
            $table->string('parent_code')->default('top')->index()->comment('父模块');
            $table->string('name')->comment('模块名称');
            $table->string('introduction')->comment('模块简介');
            $table->unsignedInteger('pricing')->default(0)->comment('价格');
            $table->string('icon')->nullable()->comment('图标');
            $table->string('cover')->nullable()->comment('缩略图');
            $table->boolean('status')->default(1)->comment('状态');
            $table->string('type')->comment('类型');
            $table->unsignedInteger('order')->comment('顺序');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('modules');
    }
}
